package de.baumann.browser.present.gg

import de.baumann.browser.api.OdinObserver
import de.baumann.browser.api.net.vo.gg.XXYY
import de.baumann.browser.base.BasePresenter
import de.baumann.browser.iview.gg.IMyMortgageView
import de.baumann.browser.model.recordTotal
import de.baumann.browser.utils.getUser

class MyMortgagePresenter : BasePresenter<IMyMortgageView>() {

    fun xxyy(address:String) {
        var a = address
        if (a.startsWith("odx")){
            a = "0${address.substring(2)}"
        }
        recordTotal(a)
                .subscribe(object : OdinObserver<XXYY>() {
                    override fun onSuccess(data: XXYY?) {
                        if (data!=null){
                            view?.x(data.morgageTotal)
                            view?.y(data.airdropTotal)
                        }
                    }
                })
    }
}